package com.ellwood.copyright.common.core.exception;

import com.ellwood.copyright.common.core.enums.HttpCodeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.EqualsAndHashCode;
import lombok.Getter;

import java.io.Serial;

/**
 * @ProjectName: ell-copyright-pro
 * @PackageName: com.ellwood.copyright.common.core.exception
 * @ClassName: SystemException
 * @Description: // TODO
 * @Author: Ellwood
 * @CreateDate: 2024/11/12 - 11:54
 * @Version: V1.0.0
 */
@Getter
@EqualsAndHashCode(callSuper=true)
@Schema(description = "系统异常")
public class SystemException extends RuntimeException{

    @Serial
    private static final long serialVersionUID = -4561678466560749513L;

    @Schema(description = "异常状态码")
    private Integer code;

    @Schema(description = "异常信息")
    private String message;

    public SystemException(HttpCodeEnum httpCodeEnum) {
        super(httpCodeEnum.getMessage());

        this.code = httpCodeEnum.getCode();
        this.message = httpCodeEnum.getMessage();

    }

}
